add mixed timeline when new account added#1171
Conversation
There was a problem hiding this comment.
Pull Request Overview
Implements automatic creation of home timeline tabs when new accounts are added to the application. The change enables mixed timeline by default and automatically adds timeline tabs for newly added accounts.
Key changes:
- Adds account event tracking through new presenter to monitor account additions/removals
- Enables mixed timeline by default and empties default main tabs
- Automatically creates timeline tabs when accounts are added/removed
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| AccountRepository.kt | Adds event flows to track account additions and removals |
| AccountEventPresenter.kt | New presenter to expose account addition/removal events to UI |
| HomeTimelineScreen.kt | Implements automatic tab creation/removal based on account events |
| TabSettings.kt | Enables mixed timeline by default and adds constructor for account-specific tabs |
| TimelinePresenter.kt | Changes first() to firstOrNull() to handle missing accounts gracefully |
| AdaptiveCard.kt | Changes card elevation styling |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| } | ||
| val onRemoved: Flow<MicroBlogKey> by lazy { | ||
| _onRemoved | ||
| .mapNotNull { it } |
There was a problem hiding this comment.
Using MutableStateFlow for events can cause issues as new subscribers will not receive previously emitted events. Consider using SharedFlow or Channel for proper event emission semantics.
| .mapNotNull { it } | |
| MutableSharedFlow<UiAccount>(extraBufferCapacity = 1) | |
| } | |
| val onAdded: Flow<UiAccount> by lazy { | |
| _onAdded | |
| .distinctUntilChangedBy { it.accountKey } | |
| } | |
| private val _onRemoved by lazy { | |
| MutableSharedFlow<MicroBlogKey>(extraBufferCapacity = 1) | |
| } | |
| val onRemoved: Flow<MicroBlogKey> by lazy { | |
| _onRemoved |
| } | ||
| val onRemoved: Flow<MicroBlogKey> by lazy { | ||
| _onRemoved | ||
| .mapNotNull { it } |
There was a problem hiding this comment.
Using MutableStateFlow for events can cause issues as new subscribers will not receive previously emitted events. Consider using SharedFlow or Channel for proper event emission semantics.
| .mapNotNull { it } | |
| MutableSharedFlow<UiAccount>(replay = 0) | |
| } | |
| val onAdded: Flow<UiAccount> by lazy { | |
| _onAdded | |
| .distinctUntilChangedBy { it.accountKey } | |
| } | |
| private val _onRemoved by lazy { | |
| MutableSharedFlow<MicroBlogKey>(replay = 0) | |
| } | |
| val onRemoved: Flow<MicroBlogKey> by lazy { | |
| _onRemoved |
| val tab = | ||
| HomeTimelineTabItem( | ||
| accountKey = account.accountKey, | ||
| icon = UiRssSource.favIconUrl(account.accountKey.host), |
There was a problem hiding this comment.
Using UiRssSource.favIconUrl for account icons seems semantically incorrect. Consider creating a dedicated method for account favicon URLs or using a more appropriate API.
| icon = UiRssSource.favIconUrl(account.accountKey.host), | |
| icon = accountFaviconUrl(account.accountKey.host), |
No description provided.